home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekkan Dennou Club 145
/
Gekkan Dennou Club - 2000.6 Vol. 145 (Japan).7z
/
Gekkan Dennou Club - 2000.6 Vol. 145 (Japan) (Track 1).bin
/
games
/
spassion
/
knowhow.lzh
/
ノウハウ
/
sam_sh.bas
< prev
next >
Wrap
BASIC Source File
|
1993-11-10
|
19KB
|
687 lines
char s,n
int i,j
int x,y
float fx,fy,f
/*
/*===============[ ジキ ]================================
int jx,jy /* ジキザヒョウ
int j_sp=6 /* ジキソクド
dim int j_vx(9),j_vy(9) /*ジキ イドウベクトル
dim char tenkey(9)={0,8,9,6,3,2,1,4,7}
/*
int jk /* ジキカタムキ
int old_strig /* マエノループノ トリガノアタイ
int jd_way = 14 /* ( ジキショットノホウコウスウ )-1
/*
/*===============[ ジキダン ]=============================
char jd_max=59 /* ( ガメンチュウノ サイダイスウ )-1
dim int jd_x(63) ,jd_y(63) /* ザヒョウ
dim int jd_vx(63),jd_vy(63) /* ベクトル
dim int jd_vx_dat(15),jd_vy_dat(15) /* ジキノカクサンショットノ ベクトルデータ
dim char jd_stock(63) /* ガメンガイニアル ジキダンノ ナンバー
char jd_pointer /* jd_stock ノ ポインタ
/*
/*===============[ ハヘン ]================================
char ha_max=63 /* ( ガメンチュウノ サイダイスウ )-1
dim int ha_x(63) ,ha_y(63) /* ザヒョウ
dim int ha_vx(63),ha_vy(63) /* ベクトル
dim char ha_s(63) /* ハヘンノ シュルイナンバー
dim char ha_timer(63) /* ハヘンノ ショリヨウ
dim char ha_stock(63) /* ガメンガイニアル ハヘンノ ナンバー
char ha_pointer /* ha_stock ノ ポインタ
/*
/*===============[ テキ ]=================================
char tk_max=31 /* ( ガメンチュウノ サイダイスウ )-1
dim int tk_x(63) ,tk_y(63) /* ザヒョウ
dim int tk_vx(63),tk_vy(63) /* ベクトル
dim char tk_s(63) /* テキノ シュルイナンバー
dim char tk_ang(63) /* テキノ ホウコウナンバー
dim char tk_com(63) /* テキノ シュウゴウタイ カンリヘンスウ
dim char tk_timer(63) /* テキノ ショリヨウ
dim char tk_attrib(63) /* テキノ ショリノ ゾクセイ
/* ビット0 ーーー ジキヘノ アタリハンテイノ ウム
/* ビット1 ーーー ジキダンヘノ アタリハンテイノ ウム
/* ビット2 ーーー ガメンガイニデタカ?チェックノ ウム
dim char tk_stock(63) /* ガメンガイニ デタ テキノナンバー
char tk_pointer /* tk_stock ノ ポインタ
dim int tk_life(63) /* テキノ タイキュウリョク
dim int tk_life_dat(6)={0,0,0, 1,1,30,30} /*テキノ シュルイベツ タイキュウリョクデータ
/*
/*=================[ カソウ VRAM ]=========================
int xxxxx1(255) /* アンゼンバッファ
int hit_chk_x(255) /* アタリハンテイヨウ カソウVRAM
int xxxxx2(255) /* アンゼンバッファ
int hit_chk_y(255) /* アタリハンテイヨウ カソウVRAM
int xxxxx3(255) /* アンゼンバッファ
/*
/*=================[ ソノタ ]==============================
float cir_x(255) ,cir_y(255)
int cir_2x(255) ,cir_2y(255)
int cir_4x(255) ,cir_4y(255)
int cir_8x(255) ,cir_8y(255)
int cir_16x(255),cir_16y(255)
int cir_64x(255),cir_64y(255)
int hd16(255) /* スプライトコード ハンテンデータ
int hd32(255) /* スプライトコード ハンテンデータ
char qtoc(255) /* タンイベクトルヘンカンヨウ カクドデータ
char bom_ang1,bom_ang2 /* bom ルーチンデ シヨウ
char r1,r7,r255,r1023
/*============[ ショキチセッテイ & ソノタノショキカ ]===================
game_init()
home(0,0,0)
fill(0,0,10,255,1) /* ショリソクドメーター
/*
/*
/*
/*
/*======================================================
/*######################################################
/*
/* MAIN
/*
/*######################################################
/*======================================================
/*
/*
while inkey$(0)=""
vwait2(0)
palet(1,65535) /* ショリソクドメーター ON
/*----------------[ カソウvramクリア ]---------------
hit_chk_x(0)=0 :hit_chk_y(0)=0
hit_chk_x(1)=0 :hit_chk_y(1)=0
hit_chk_x(2)=0 :hit_chk_y(2)=0
hit_chk_x(3)=0 :hit_chk_y(3)=0
hit_chk_x(4)=0 :hit_chk_y(4)=0
hit_chk_x(5)=0 :hit_chk_y(5)=0
hit_chk_x(6)=0 :hit_chk_y(6)=0
hit_chk_x(7)=0 :hit_chk_y(7)=0
hit_chk_x(8)=0 :hit_chk_y(8)=0
hit_chk_x(255)=0:hit_chk_y(255)=0
/*----------------[ テキ ]------------------
tk_move()
/*----------------[ テキハッセイ ]------------------
if (r255 and 63)=0 then tk_set(4,(r255+16)shl 8,0, 0,0 ,0,0)
if r1023=0 then tk_set(5,&h8000,0, 0,0 ,0,0)
/*----------------[ ジキ ]-----------------
jk_move(stick(1))
jd_move(strig(1))
/*----------------[ ハヘン ]-----------------
ha_move()
/*================[ ハンヨウ カウンター ]========================
r1 =r1 +1 and 1
r7 =r7 +1 and 7
r255 =r255 +1 and 255
r1023=r1023+1 and 1023
/*------------------------------------------------------
palet(1,0) /* ショリソクドメーター OFF
endwhile
end
/*
/*
/*
/*
/*######################################################
/*
/* 自機移動
/*
/* jk_move(スティックナンバー)
/*======================================================
func jk_move(s)
int a,hit_dat,or_dat
char n,ii
/*......................................................
a = j_vx(s)
jx=jx+a
jy=jy+j_vy(s)
/*
if jx<&H1000 then jx=&H1000
if jx>&H10000 then jx=&H10000
if jy<&H1000 then jy=&H1000
if jy>&H10000 then jy=&H10000
/*-----[ ジキ カタムキショリ ]-----------------------------------
if a>0 then { jk=jk+1 } else { jk=jk-1 }
if a=0 then { if jk>0 then { jk=jk-1 }else{ jk=jk+1 } }
n=1
if jk<-4 then n=0:jk=-4
if jk> 4 then n=2:jk= 4
sp_set(0,jx shr 8,jy shr 8,&H905+n,3)
/*-----[ ジキ ー テキ カンノ カソウvramシキ アタリハンテイ ]----------------
hit_dat = hit_chk_x(jx shr 13)
if hit_dat<>0 then {
hit_dat = hit_dat and hit_chk_y(jy shr 13)
if hit_dat<>0 then {
/*
or_dat=1
for ii=0 to tk_max
if (hit_dat and or_dat)<>0 then {
if abs(jy-tk_y(ii))<&hA00 then {
if abs(jx-tk_x(ii))<&hA00 then {
if (tk_attrib(ii)and 1)<>0 then { /* ジキニ ハンテイノ アルキャラカ?チェック
tk_hit(ii,65535)
}
}
}
}
or_dat=or_dat shl 1
next
}
}
/*--------------------------
endfunc
/*
/*
/*######################################################
/*
/* 自機弾処理
/*
/* jd_move(トリガナンバー)
/*======================================================
func jd_move(s)
char i,j,ii,jj,no,ang
int x,y,or_dat
int hit_dat
/*......................................................
/*-----------[ ジキダンハッシャ チェック & ハッシャ ]-----------------
if (old_strig and 1)=0 and (s and 1)=1 then {
if jd_pointer>jd_way then {
for i=0 to jd_way
jd_pointer=jd_pointer-1
no=jd_stock(jd_pointer)
jd_x(no) =jx :jd_y(no) =jy
jd_vx(no)=jd_vx_dat(i):jd_vy(no)=jd_vy_dat(i)
next
}
}
old_strig = s
/*------------[ ジキダンイドウ & アタリハンテイ ]-----------------
jd_pointer=0
/*
for i=0 to jd_max
y=jd_y(i)
if y>=0 then {
x = jd_x(i)+ jd_vx(i) :jd_x(i)=x
y = y + jd_vy(i) :jd_y(i)=y
if x<0 or x>&h11000 then {
jd_y(i)=-1
sp_set(4+i,0,0)
jd_stock(jd_pointer)=i
jd_pointer=jd_pointer+1
} else {
/*------[ カソウvramシキ アタリハンテイ ]------
hit_dat = hit_chk_x(x shr 13)
if hit_dat<>0 then {
hit_dat = hit_dat and hit_chk_y(y shr 13)
if hit_dat<>0 then {
/*
or_dat=1
for ii=0 to tk_max
if (hit_dat and or_dat)<>0 then {
if abs(y-tk_y(ii))<&h1000 then {
if abs(x-tk_x(ii))<&h1000 then {
if (tk_attrib(ii)and 2)<>0 then { /* ショットニハンテイノ アルキャラカ?チェック
tk_hit(ii,1)
jd_y(i)=-1:sp_set(i+4,0,0)
}
}
}
}
or_dat=or_dat shl 1
next
}
}
/*---------------------------------
sp_set(i+4,x shr 8,y shr 8,&h13f,3)
}
} else {
sp_set(4+i,0,0)
jd_stock(jd_pointer)=i
jd_pointer=jd_pointer+1
}
next
/*------------------------------------------------------
endfunc
/*
/*
/*######################################################
/*
/* 破片処理
/*
/* ha_move()
/*======================================================
func ha_move()
char i,for_start,for_end,s
int a
int x,y
/*......................................................
if r1=0 then ha_pointer=0
/*
for_start = r1 shl 5
for_end = for_start+31
s=64
/*
for i=for_start to for_end
switch ha_s(i)
case 0
ha_stock(ha_pointer)=i
ha_pointer=ha_pointer+1
break
case 1 /*----------------[ バクハツ ]
a = ha_timer(i)-12-(i and 7):ha_timer(i)=a
if a<0 then {
ha_s(i)=0
sp_set(s,0,0)
} else {
x = ha_x(i)+ha_vx(i):ha_x(i)=x
y = ha_y(i)+ha_vy(i):ha_y(i)=y
sp_set(s,x shr 8,y shr 8,&h148+(a shr 5),3)
if ((i+r7)and 7)<2 then {
ha_vx(i)=ha_vx(i)/4
ha_vy(i)=ha_vy(i)/4
}
}
break
case 2 /*----------------[ ハヘン ]
a = ha_timer(i)-10-(i and 15):ha_timer(i)=a
if a<0 then {
ha_s(i)=0
sp_set(s,0,0)
} else {
x = ha_x(i)+ha_vx(i):ha_x(i)=x
y = ha_y(i)+ha_vy(i):ha_y(i)=y
sp_set(s,(x shr 8)and 1023,(y shr 8)and 1023,&h140+((a shr 5) and 3)+(i and 4),3)
}
break
case 3 /*----------------[ ケムリ ]
a = ha_timer(i)-32:ha_timer(i)=a
if a<0 then {
ha_s(i)=0
sp_set(s,0,0)
} else {
x = ha_x(i)+ha_vx(i):ha_x(i)=x
y = ha_y(i)+ha_vy(i):ha_y(i)=y
sp_set(s,(x shr 8)and 1023,(y shr 8)and 1023,&h223-(a shr 6),3)
}
break
endswitch
s=s+1:next
endfunc
/*
/*
/*######################################################
/*
/* 破片発生
/*
/* ha_set(種類no,x,y,xベクトル,yベクトル)
/*======================================================
func ha_set(s,x,y,vx,vy)
char no
/*......................................................
if ha_pointer>0 and s<>0 then {
ha_pointer=ha_pointer-1
no=ha_stock(ha_pointer)
ha_x(no) =x :ha_y(no) =y
ha_vx(no)=vx:ha_vy(no)=vy
ha_s(no)=s
ha_timer(no)=255
}
endfunc
/*
/*
/*######################################################
/*
/* 敵処理
/*
/* tk_move()
/*======================================================
func tk_move()
char i
char x_adr,y_adr /* アタリハンテイヨウ カソウvramジョウノアドレス
int or_dat=1 /* カソウvramノ ドノビットヲ タテルカ
int ts,tx,ty,a,b
char attrib,ang,angle1,angle2
/*......................................................
tk_pointer=0
/*
for i=0 to tk_max
tx = tk_x(i)
ty = tk_y(i)
ts=tk_s(i)
switch ts
case 0
attrib = 0
tk_stock(tk_pointer)=i
tk_pointer=tk_pointer+1
break
/*
case 1 /*----------------[ バクハツ ]
attrib = 0
a = tk_timer(i)-16:tk_timer(i) = a
if a<0 then {
tk_s(i)=0:sp_set(96+i,0,0)
} else {
sp_set(i+96,tx shr 8,ty shr 8,&h148+(a shr 5),3)
}
break
/*
case 2 /*----------------[ テキダン ]
attrib = &b101
tx =tx + tk_vx(i)
ty =ty + tk_vy(i)
a = tk_timer(i)+1 and 15:tk_timer(i) = a
sp_set(i+96,tx shr 8,ty shr 8,&hC18+(a shr 1),3)
break
/*
case 3 /*----------------[ ホーミングミサイル ]
attrib = &b111
angle1 = tk_ang(i)
angle2 = angle(jx-tx,jy-ty) and 252
if ((angle2-angle1) and 252)<>0 then {
if (angle2-angle1 and 128)=0 then {
angle1 = angle1+4 and 255
} else {
angle1 = angle1-4 and 255
}
}
tk_ang(i) = angle1
/*
tx =tx +cir_8x(angle1)
ty =ty +cir_8y(angle1)
sp_set(i+96,tx shr 8,ty shr 8,&h130 or hd16(angle1),3)
if (r255+i and 1)=0 then ha_set(3,tx,ty,-cir_8x(angle1),-cir_8y(angle1))
break
/*
case 4 /*----------------[ ザコ1 ]
attrib = &b111
ty = ty+&h300
sp_set(i+96,tx shr 8,ty shr 8,&h128+(i+r7 and 7),3)
if (r255+i and 31)=0 then {
ang = angle(jx-tx,jy-ty)
tk_set(3,tx,ty, 0,0, ang ,0)
tk_set(3,tx,ty, 0,0, ang+64 and 255,0)
tk_set(3,tx,ty, 0,0, ang-64 and 255,0)
tk_set(2,tx,ty, cir_4x(ang),cir_4y(ang), ang,0)
}
break
case 5 /*----------------[ ボス? ]
attrib = &b111
if ty<&h6000 then ty=ty+&h100
sp_set(i+96,tx shr 8,ty shr 8,&h8928,3)
if (r255 and &h49)=0 then {
ang = angle(jx-tx,jy-ty)
tk_set(2,tx,ty, cir_8x(ang),cir_8y(ang), ang,0)
}
if (r255 and &h43)=&h40 then {
ang = r255 and 63
tk_set(2,tx,ty, cir_8x( 128 + ang ),cir_8y( 128 + ang ), 128+ang ,0)
tk_set(2,tx,ty, cir_8x( 128 - ang ),cir_8y( 128 - ang ), 128-ang ,0)
}
break
case 6 /*----------------[ ボス ゴエイザコ ]
attrib = &b011
ang = tk_ang(i)+5 and 255:tk_ang(i)=ang
a = tk_com(i)
tx = tk_x(a) + cir_64x(ang)
ty = tk_y(a) + cir_64y(ang)
sp_set(i+96,(tx shr 8) and 1023,(ty shr 8)and 1023,&h128+(i+r7 and 7),3)
/*
if tk_s(a)=0 then tk_hit(i,65535)
break
/*...................................................
endswitch
tk_attrib(i)=attrib
tk_x(i) = tx
tk_y(i) = ty
/*-----------------------------------------------------
/*......[ カソウvram カキコミ ]...............................
if (attrib and 3)<>0 then {
x_adr=((tx-&h1000)shr 13)
hit_chk_x( x_adr ) = hit_chk_x( x_adr )or or_dat
hit_chk_x( x_adr+1 ) = hit_chk_x( x_adr+1 )or or_dat
y_adr=((ty-&h1000)shr 13)
hit_chk_y( y_adr ) = hit_chk_y( y_adr )or or_dat
hit_chk_y( y_adr+1 ) = hit_chk_y( y_adr+1 )or or_dat
}
/*......[ ガメンガイニデタカ?チェック ]..........................
if (attrib and 4)<>0 then {
if (ty and &h7FFFFFFF)>&h11000 or (tx and &h7FFFFFFF)>&h11000 then tk_s(i)=0:sp_set(96+i,0,0)
}
/*------------------------------------------------------
or_dat=or_dat shl 1
next
endfunc
/*
/*
/*######################################################
/*
/* 敵発生
/*
/* tk_set(種類no,x,y, xベクトル,yベクトル,方向No,集合先)
/*======================================================
func tk_set(s,x,y,vx,vy,ang,com)
char no,i
/*......................................................
if tk_pointer>0 and s<>0 then {
tk_pointer=tk_pointer-1
no=tk_stock(tk_pointer)
/*.......................................
tk_s(no)=s
tk_x(no) =x :tk_y(no) =y
tk_vx(no)=vx:tk_vy(no)=vy
tk_ang(no)=ang
tk_com(no)=com
/*
tk_timer(no)=255
tk_life(no) =tk_life_dat(s)
/*........................................
if s=5 then {
for i=0 to 7
tk_set(6,x,y, 0,0, (i shl 5),no)
next
}
/*........................................
}
endfunc
/*
/*
/*######################################################
/*
/* 敵に HIT
/*
/* tk_hit(no,ダメージ数)
/*======================================================
func tk_hit(no;char,damege)
int tx,ty
char ang
/*......................................................
tk_life(no) = tk_life(no)-damege
if tk_life(no)<=0 then {
tx=tk_x(no):ty=tk_y(no)
if tk_s(no)>=4 then bom(5,tx,ty)
tk_s(no)=1:tk_timer(no)=255
tk_attrib(no)=0
}
/*------------------------------------------------------
endfunc
/*
/*
/*######################################################
/*
/* 破片炸裂
/*
/* bom(破片数,x,y)
/*======================================================
func bom(s,x,y)
int i
/*......................................................
for i=0 to s
ha_set(2,x,y,cir_4x(bom_ang1),cir_4y(bom_ang2))
bom_ang1 = bom_ang1+77 and 255
bom_ang2 = bom_ang2+53 and 255
next
endfunc
/*
/*
/*#######################################################
/*
/* 角度計算(高速 & 誤差軽減)
/*
/* angle(ex-sx,ey-sy)で(sx,sy)から見た(ex,ey)の角度算出。
/* テーブルとして qtoc(255) を使用。忘れずLOADせよ。
/* 戻り値 = 角度ナンバー(0ー255)
/*-------------------------------------------------------
func angle(x,y)
int a,abs_x,abs_y
/*
if x=0 then x=1
if y=0 then y=1
if x>0 then abs_x=x else abs_x=-x
if y>0 then abs_y=y else abs_y=-y
if abs_x>abs_y then {
if x>0 then {
if y>0 then {
a=&h40 + ((y shl 5)+(abs_x shr 1))/abs_x
} else {
a=&h40 + ((y shl 5)-(abs_x shr 1))/abs_x
}
} else {
if y>0 then {
a=&hC0 - ((y shl 5)+(abs_x shr 1))/abs_x
} else {
a=&hC0 - ((y shl 5)-(abs_x shr 1))/abs_x
}
}
} else {
if y>0 then {
if x>0 then {
a=&h80 - ((x shl 5)+(abs_y shr 1))/abs_y
} else {
a=&h80 - ((x shl 5)-(abs_y shr 1))/abs_y
}
} else {
if x>0 then {
a= ((x shl 5)+(abs_y shr 1))/abs_y
} else {
a= ((x shl 5)-(abs_y shr 1))/abs_y
}
}
}
/*ーーーーーーーーーーーーーーーーー
return(qtoc(a and 255))
endfunc
/*
/*
/*######################################################
/* GAME_INIT()
/*
/* game_init()
/* GAMEの初期化
/*======================================================
func game_init()
int i,j,fn
float f,fx,fy,angle,pi_dat
/*......................................................
scr_init()
/*--------------[ カクシュデータ LOAD ]-----------------------
fn = chk_open("CIR\QtoC","r")
fread(qtoc,256,fn):fclose(fn)
/*
fn = chk_open("CIR\HD16","r")
fread(hd16,256,fn):fclose(fn)
/*
/*--------------[ sin/cos ベクトル データ ]------------------
pi_dat=pi()
for i=0 to 255
f=i
angle = -pi_dat*(0.5#-2*f/256)
fx = cos(angle)
fy = sin(angle)
cir_x(i) = fx
cir_y(i) = fy
/*..............[ データ カクチョウ ]................
cir_2x(i) = fx*&h200
cir_2y(i) = fy*&h200
cir_4x(i) = fx*&h400
cir_4y(i) = fy*&h400
cir_8x(i) = fx*&h800
cir_8y(i) = fy*&h800
cir_16x(i)= fx*&h1000
cir_16y(i)= fy*&h1000
cir_64x(i)= fx*&h4000
cir_64y(i)= fy*&h4000
next
/*--------------[ ジキイドウベクトル データ ]-------------------
j=1
for i=0 to 255
j_vx(tenkey(j))=cir_x(i)*j_sp*&H100
j_vy(tenkey(j))=cir_y(i)*j_sp*&H100
j=j+1:i=i+31
next
/*--------------[ ジキダンベクトル データ ]--------------------
for i=0 to 14
j=(i-7)*4 and 255
fx=cir_x(j)*&hC00:jd_vx_dat(i)=fx
fy=cir_y(j)*&hC00:jd_vy_dat(i)=fy
next
/*------------------------------------------------------
for i=0 to 127
sp_set(i,0,0) /* ゼンスプライトノショウキョ
next
/*------------------------------------------------------
for i=0 to 63
jd_y(i)=-1 /* ゼンジキダンヲ ガメンガイヘ
ha_s(i)=0 /* ゼンハヘンノシュルイナンバーヲ 0ニ
tk_s(i)=0 /* ゼンテキノシュルイナンバーヲ 0ニ
next
/*------------------------------------------------------
jd_pointer=0
ha_pointer=0
tk_pointer=0
jx=&h8000:jy=&hC000
/*------------------------------------------------------
endfunc
/*
/*
/*######################################################
/* SCR_INIT()
/*
/* scr_init()
/* 画面を GAME専用に設定する。
/*======================================================
func scr_init()
int i
/*-------------------------
screen 0,2,1,1
sp_on(0,127)
for i=0 to 127:sp_set(i,0,0,0,3):next
sp_disp(1)
bg_set(0,0,1):bg_scroll(0,0,0)
bg_set(1,1,1):bg_scroll(1,0,0)
bg_fill(0,0):bg_fill(1,0)
mouse(4):mouse(2)
endfunc
/*
/*
/*##########################################################/*
/* CHK_OPEN /*
/* chk_open( "filename","モード" ) /*
/* モードは、fopen と同じ。
/*----------------------------------------------------------/*
func chk_open(fname;str,mode;str)
int fn
/*::::::::::::::::
error off
fn=fopen(fname,mode)
error on
if fn<0 then {
width 96
color 7:beep
print fname;" が、OPENできません。"
print
print "強制終了します。( HIT ANY KEY )"
while strig(1)<>0 or strig(2)<>0 or inkey$(0)<>"":endwhile
while strig(1)=0 and strig(2)=0 and inkey$(0)="" :endwhile
end
}
return(fn)
endfunc